﻿/****************************** Module Header ******************************\
 * Module Name:  TaskHelper.cs
 * Module Version:  1.0.0 (2014-4-7)
 * Copyright (c) AnyEB.Com (14507247@qq.com)
 * 
 * This class is used to send email by Net MailMessage dll. It supplies 
 * useful method to send a email by SMTP server.
 * 
 * This source is subject to the GPL License.
 * See http://www.gnu.org/licenses/gpl.html.
 * All other rights reserved.
 * 
 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
\***************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace UCL
{
    /// <summary>
    /// 异步任务帮助类
    /// </summary>
    /// <remarks>2014-4-7 by sutroon</remarks>
    public class TaskHelper
    {
        /// <summary>
        /// 数据加载中提示窗口接口
        /// </summary>
        public interface ILoadingWindow
        {
            void Show();
            void Close();
        }

        /// <summary>
        /// 数据加载中提示窗口
        /// </summary>
        public ILoadingWindow LoadingWindow;

        /// <summary>
        /// 显示数据加载中提示窗口
        /// </summary>
        /// <param name="frm"></param>
        public void ShowLoading(ILoadingWindow frm)
        {
            LoadingWindow = frm;
            frm.Show();
        }

        /// <summary>
        /// 隐藏数据加载中提示窗口
        /// </summary>
        public void HideLoading()
        {
            if (LoadingWindow == null) return;
            LoadingWindow.Close();
        }
    }
}
